import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-template-form',
  templateUrl: './template-form.component.html',
  styleUrls: ['./template-form.component.css']
})
export class TemplateFormComponent implements OnInit {

  private userNameRequiredValid: boolean = false;
  private userNameMinlengthValid: boolean = false;
  private mobileValid: boolean = false;
  constructor() { }

  ngOnInit() {
  }
  onSubmit(value:any) {
    console.log(value);
  }
  inputValidate(myForm) {
    console.log(myForm.form.get('userName').touched);
    this.userNameRequiredValid = !myForm.form.hasError('required', 'userName');
    this.userNameMinlengthValid = !myForm.form.hasError('minlength', 'userName');
  }
  mobileValidate(myForm, name) {
    this.mobileValid = !myForm.form.hasError('mobile', name);
    console.log(this.mobileValid);
  }
}
